<!-- 客户变更 流程表单（流程中提交表单和审批表单）-->
<!--
  - Copyright (c) 2019.
  - 北京九思金信科技有限公司对该文件内容保留所有权利。
  - 未经许可，不得私自拷贝、传播、发布、引用该文件内容，违者将被追究法律责任。
  -->

<template>
    <div>
        <div v-if="changeBaseInfo.customerType === 'ENTERPRISE'">
            <customer-corp-change-flow-form :busi-data-id="busiDataId"
                                            :editable="editable">
            </customer-corp-change-flow-form>
        </div>
        <div v-if="changeBaseInfo.customerType === 'PERSONAL'">
            <customer-person-change-flow-form :busi-data-id="busiDataId"
                                              :editable="editable">
            </customer-person-change-flow-form>
        </div>
    </div>
</template>

<script>
    import CustomerCorpChangeFlowForm from "./CustomerCorpChangeFlowForm.vue";
    import CustomerPersonChangeFlowForm from "./CustomerPersonChangeFlowForm.vue";
    export default {
        name: "CustomerChangeFlowForm",
        components: {
            'customer-corp-change-flow-form': CustomerCorpChangeFlowForm,
            'customer-person-change-flow-form': CustomerPersonChangeFlowForm
        },
        props: {
            busiDataId: {type: String},
        },
        data() {
            return {
                customerId: this.busiDataId,
                changeBaseInfo: {},
                editable: false,
            }
        },
        mounted() {
            this.loadCustomerType()
        },
        methods:{
            loadCustomerType() {
                this.$http.get('/joys-rest/lss-customer/custChange/base/info/' + this.customerId).then(
                    resp => {
                        this.changeBaseInfo = resp.body
                        // 设置表单是否可编辑
                        if (this.changeBaseInfo.billStatus === 'INITIAL') {
                            this.editable = true
                        } else {
                            this.editable = false
                        }
                    },
                    resp => {
                        this.$message.error('加载客户类型失败！')
                    }
                )
            },
        }
    }
</script>

<style scoped>

</style>
